<template>
  <div id="jurisdiction">
    <div class="homeTitle">栏目权限管理</div>
    <div class="btn">
      <el-button type="primary" size="small" @click="addjuese">添加栏目操作角色</el-button>
    </div>
    <div class="bottomTable">
      <div class="table">
        <table>
          <tr>
            <td>系统栏目编号</td>
            <td>系统栏目名称</td>
            <td>所属父栏目</td>
            <td>已赋权角色</td>
            <td>操作</td>
          </tr>
          <tr v-for="(item, index) in tableBottom" :key="index">
            <td>{{item.no}}</td>
            <td>{{item.mName}}</td>
            <td>{{item.parentName}}</td>
            <td>{{item.juese}}</td>
            <td>
              <el-button type="primary" size="small" @click="peizhi(item)">配置栏目权限</el-button>
            </td>
          </tr>
        </table>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'jurisdiction',
  data () {
    return {
      tableBottom: []
    };
  },
  mounted () {
    this.getdata();
  },
  methods: {
    getdata () {
      this.axios.get('roleMenu/selectMenuList')
        .then(({data})=> {
          if (data.code == 200) {
            let temp = [];
            data.data.forEach(element => {
              temp = [];
              element.roles.forEach(item => {
                temp.push(item.name);
              })
              element.juese =temp.join('、');
            });
            this.tableBottom = data.data;
          }
        })
    },
    peizhi (item) {
      this.$router.push({path:'configure', query:{id: item.mId}});
    },
    addjuese() {
      this.$router.push('addColumn');
    }
  }
};
</script>

<style lang="scss">
  #jurisdiction {
    .btn {
      padding: 20px 0;
    }
    .bottomTable {
    table {
      border: 1px solid white;
      width: 100%;
      border-collapse: collapse;
      tr {
        &:first-child {
          background-color: #181C1D !important;;
          color: white;
          td {
            background-color: #181C1D !important;
          }
        }
        td {
          text-align: center;
          padding: 10px 10px;
          border-right: 1px solid white;
          border-bottom: 1px solid white;
          color: white;
          background: rgba(53, 58, 58, 0.55);
        }
    }
    }
    .addwhite {
      height: 46px;
      background-color: white;
      padding: 0 20px;
      span {
        color: #cccccc;
        line-height: 46px;
      }
    }
  }
  }
</style>
